<?php
class Auth
{
    function run()
    {
        $ci = & get_instance(); //dung de goi ham giong $this
        $a = $ci->router->fetch_directory();
        if (substr($ci->router->fetch_directory(), 0, 5) == 'admin') //kiem tra tren uri 5 ki tu dau cua thu muc chua controler co la admin k?
        {
            $user_role = $ci->session->userdata('user_role');
            if ($user_role != 'administrator') {
                redirect('admin/user/login');
            }
        }
    }
}